package sg.edu.nus.iss.club.gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class AddFacilityDialog extends sg.edu.nus.iss.club.gui.util.OkCancelDialog {

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private JLabel jLabel1;
	private JLabel jLabel2;
	private JTextField descriptionTextField;
	private JTextField nameTextField;
	public ClubApplication clubApplication;

	public AddFacilityDialog(JFrame frame) {
		super(frame, "Add Facility");
	}
	
	protected JPanel createFormPanel() {
		JPanel formPanel = new JPanel();
		formPanel.setLayout(null);
		try {
			{
				jLabel1 = new JLabel();
				formPanel.add(jLabel1);
				jLabel1.setText("Name");
				jLabel1.setBounds(12, 12, 83, 16);
			}
			{
				nameTextField = new JTextField();
				formPanel.add(nameTextField);
				nameTextField.setBounds(108, 9, 193, 23);
			}
			{
				descriptionTextField = new JTextField();
				formPanel.add(descriptionTextField);
				descriptionTextField.setBounds(107, 44, 193, 23);
			}
			{
				jLabel2 = new JLabel();
				formPanel.add(jLabel2);
				jLabel2.setBounds(12, 47, 83, 16);
				jLabel2.setText("Description");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return formPanel;
	}
	
	protected boolean performOkAction() {
		clubApplication.addFacility(nameTextField.getText(), descriptionTextField.getText()); 
		clubApplication.getMainWindow().refresh();
		return true;
	}
	
}
